<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1 user-scalable=0">
<link rel="stylesheet" href="<%=basePath%>assets/css/public.css">
<link rel="stylesheet"
	href="<%=basePath%>assets/css/idangerous.swiper.css">
<link rel="stylesheet" href="<%=basePath%>assets/css/page.css">
<link rel="stylesheet"
	href="<%=basePath%>assets/font-awesome-4.7.0/css/font-awesome.min.css">
<title>搜索结果</title>
<script src="<%=basePath%>assets/js/jquery-1.8.3.min.js"></script>
<script src="<%=basePath%>assets/js/fontSize.js"></script>

<style>
body{
	padding-top: 0.8rem;
}
.header {
	background: #f8f8f8;
}
.search {
	width: 65%;
	border-bottom: 1px solid #f1f1f1;
	border-radius: 0.05rem;
	height: 0.6rem;
	line-height: 0.6rem;
	background: #FFFFFF url(<%=basePath%>assets/imgMenu/ss.png) no-repeat 0.1rem 0.1rem;
	background-size: 0.4rem 0.4rem;
	padding-left: 0.6rem;
	font-size: 0.24rem;
	position: relative;
}

.content_cont ul li {
	padding: 3%;
	border-bottom: 1px solid #f1f1f1;
	position: relative;
}

.shangjiatupian {
	width: 25%;
	float: left;
}

.goodsInfo {
	width: 70%;
	float: right;
	line-height:0.4rem;
}

.goodsName {
	font-size: 0.24rem;
	line-height: 0.32rem;
	height: 0.8rem;
	padding-bottom: 0.1rem;
}
.xiaoliang {
	font-size: 0.18rem;
	line-height: 0.3rem;
}
.price {
	width: 100%;
	color: red;
	font-size: 0.2rem;
	position: absolute;
	left: 0;
	bottom: 0
}

.noSJ {
	width: 100%;
	height: 8rem;
}

.noSJ img {
	width: 50%;
	margin: 10% auto;
	display: block
}

.noSJ h3 {
	width: 100%;
	font-size: 0.25rem;
	line-height: 0.6rem;
	font-weight: bold;
	text-align: center
}

.noSJ p {
	width: 100%;
	font-size: 0.24rem;
	line-height: 0.6rem;
	text-align: center
}
</style>

</head>
<body>
	<input id="basePath" type="hidden" value="<%=basePath%>">
	<div class="header clearFirx">
		<a class=returnInfo href="#" id="fanhui"><i class="fa fa-angle-left"></i></a>
		<input id="content" type="text" placeholder="搜索" class="search" value="${content}"
			onfocus="window.location.href='<%=basePath%>jsp/app/search.jsp'">
	</div>
	<c:choose>
		<c:when test="${not empty goodsList}">
			<div class="content_cont">
				<ul id="ul">
					<c:forEach items="${goodsList}" var="goodsList">
						<li>
							<c:if test="${goodsList.goodsIdentifying eq 1}">
								<a href="<%=basePath%>app/toGoodsInfo?goodsId=${goodsList.goodsId}"class="clearFirx"> 
							</c:if>
							<c:if test="${goodsList.goodsIdentifying eq 2}">
								<a href="<%=basePath%>app/getUsedGoodsInfo?goodsId=${goodsList.goodsId}"class="clearFirx"> 
							</c:if>
							<c:if test="${goodsList.goodsIdentifying eq 3}">
								<a href="<%=basePath%>app/getWantBuyDetail?goodsId=${goodsList.goodsId}"class="clearFirx"> 
							</c:if>
								<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${goodsList.goodsThums}" alt=""  class="shangjiatupian">
								<div class="goodsInfo">
									<h3 class="goodsName">${goodsList.goodsName}</h3>
									<p class='xiaoliang'>月销${goodsList.pageView}笔</p>
									<div>
										<span style="font-size: 16px; color: red;">￥${goodsList.goodsPrice}</span>
									</div>
								</div>
						</li>

					</c:forEach>
				</ul>
			</div>
		</c:when>
		<c:otherwise>
			<div class="noSJ">
				<img src="<%=basePath%>assets/images/bcz.png" alt="">
				<h3>没有搜到您想要的宝贝</h3>
				<p>换个关键词试试</p>
			</div>
		</c:otherwise>
	</c:choose>
</body>
<script type="text/javascript">
	$(function(){
		$('.content_cont').find('li').each(function(){
        	var goodsNameHtml = $(this).find('.goodsName').html();
        	$(this).find('.goodsName').html(showText(goodsNameHtml, 28))
        })
        
        $('#ul').find('li').each(function(){
    		$(this).find('a>img').height($(this).find('a>img').width())
    	})
        //点击返回
        $("#fanhui").click(function () {
        	window.location.href="javascript:history.go(-2)";
        });
	})
	function showText(text, numSub){
		if(text == null){
			return "";
		}
		if(text.length > numSub){
			return text.substring(0, numSub) + "...";
		}
		return text;
	}
</script>
</html>